package com.xbongbong.pro.businesstage.pojo.dto;

import com.xbongbong.paas.domain.entity.PaasStageEntity;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.saas.domain.entity.ext.OpportunityEntityExt;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/3/13 13:51
 * @since v1.0
 */
@Getter
@Setter
public class ChangeStageDTO extends BaseDTO {

    private static final long serialVersionUID = -2389127981371827147L;

    /**
     * 数据id
     */
    @NotNull(message = "{dto.msg.changeStage.dataId.NotNull}")
    private Long dataId;
    /**
     * 下一阶段code【目标阶段code】
     */
    @NotNull(message = "{dto.msg.changeStage.nextCode.NotNull}")
    private String nextCode;
    /**
     * 备注
     */
    @Length(max = 500, message = "{dto.msg.changeStage.memo.Length}")
    private String memo = "";
    /**
     * 流失原因
     */
    private Integer reasonId = 0;
    /**
     * 业务类型
     */
    private Integer businessType;
    /**
     * 是否归档
     */
    private Boolean isArchive = false;
    /**
     * 更新客户状态
     */
    private Boolean isUpdateStatus = false;
    /**
     * 快捷更新（目前用于新建编辑合同将关联机会的阶段改为赢单）
     */
    private Boolean fastUpdate = false;
    /**
     * 快捷更新（目前用于新建编辑合同将关联机会的阶段改为赢单）的机会实体
     */
    private OpportunityEntityExt opportunity;
    /**
     * 目标阶段
     */
    private PaasStageEntity targetStage;
    /**
     * 来源阶段
     */
    private PaasStageEntity sourceStage;
    /**
     * saas标识
     */
    private Integer saasMark;

    public void setMemo(String memo) {
        this.memo = memo == null ? "" : memo;
    }

    public void setReasonId(Integer reasonId) {
        this.reasonId = reasonId == null ? 0 :reasonId;
    }

    public void setArchive(Boolean archive) {
        isArchive = archive != null && archive;
    }

    public void setUpdateStatus(Boolean updateStatus) {
        isUpdateStatus = updateStatus != null && isUpdateStatus;
    }
}
